Ext.define('MyApp.controller.dataview.MultiSortController', {
			extend : 'Ext.app.Controller',
			views : ['dataview.MultiSort', 'dataview.MultiSortButton'],
			stores : ['MultiSortStore'],
			models : ['MultiSortEntity'],
			requires: [
	            'Ext.ux.BoxReorderer',
	            'Ext.ux.DataView.Animated'
	        ],
			refs : [
			// { ref: 'multisort', selector: 'dataview-multisort' }
			],
			init : function() {
				this.control({
							'dataview-multisort button[type=filterButton]' : {
								click : 'onClickFilterButton'
							},
							'dataview-multisort button#clearFilterButton' : {
								click : 'onClickClearFilterButton'
							},
							'dataview-multisort dataview' : {
								itemdblclick : function(){
									alert('asdsad');
							},
							itemcontextmenu: function(view, rec, node, index, e) {
					                    e.stopEvent();
					                    Ext.create('Ext.menu.Menu', {
									        items: [
											           {glyph:0xf019,text: '下载文档', itemid:'download',
											   					 handler: function(widget, event) {
											   					 	console.log(rec.get('url'));
															      }
											           },
													   {glyph:0xf00b,text: '查看详情', itemid:'detail',
													   			 handler: function(widget, event) {
													   			 	console.log(rec.get('id')+'s'+rec.get('name'));
														}
													   }
									        		]
									    }).showAt(e.getXY());
					                    return false;
					                }
							}
						});
			},
			onClickFilterButton : function(widget) {
				dataIndex = widget.dataIndex;
				dataFilter = widget.dataFilter;
				view = widget.up('dataview-multisort').down('dataview');
				var store = view.getStore();
				store.suspendEvents();
				store.clearFilter();
				store.resumeEvents();
				store.filter([{
							fn : function(record) {
								return record.get(dataIndex) == dataFilter;
							}
						}]);
				store.filter([{
							fn : function(record) {
								return record.get(dataIndex) == dataFilter;
							}
					}]);
			},
			onClickClearFilterButton : function(widget) {
				view = widget.up('dataview-multisort').down('dataview');
				var store = view.getStore();
				store.clearFilter();
				store.filter([{
							fn : function(record) {
								return record;
							}
						}]);
			}
		});